
import { defineStore } from 'pinia';

const tipDefault = "稍等片刻，拼命加载中...";

const useSpinStore = defineStore({
  id: 'spin',
  state: () => ({
    loading: false,
    tip: tipDefault,
  }),
  actions: {
    hide() {
      this.loading = false;
      this.tip = tipDefault;
      let spins = document.querySelector('.ant-spin-nested-loading');
      spins.style.zIndex = 0;
    },
    show(tip) {
      this.loading = true;
      this.tip = tip||tipDefault;
      let spins = document.querySelector('.ant-spin-nested-loading');
      spins.style.zIndex = 9999;
    },
  },
});

export default useSpinStore;
